home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / PowerPlant / BlueLibrary Pack1 v1.1 / BlueLibrary Pack1 ƒ / BD Common ƒ / CPrefListBox.h < prev    next >
Encoding:
Text File  |  1996-06-04  |  2.5 KB  |  81 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CPrefListBox.h
  3. //    Written by Christophe Causer
  4. //    ©1995 BlueDays Software.  All Rights Reserved.
  5. //
  6. //    You may use this class in any non-commercial program without
  7. //    permission.  The only restriction is that you must credit the
  8. //    author in your about box.  For commercial use, please contact
  9. //    the author at the email address below.
  10. //                    
  11. //    Send bug-reports and comments to bluedays@kagi.com
  12. //    
  13. // ===========================================================================
  14.  
  15. #pragma once
  16.  
  17. #include <LListBox.h>
  18.  
  19. //----------------------------------------------------------------------------
  20.  
  21. typedef struct {
  22.     Int16        prefIconID;
  23.     ResIDT        prefSTRxID;
  24.     Int16        prefSTRidx;
  25.     PaneIDT        prefViewID;
  26.     LView        *prefView;
  27. } sPrefItem, *sPrefItemPtr ;
  28.  
  29. class LArray;
  30.  
  31. class CPrefListBox : public LListBox {
  32.  
  33.   public:
  34.       enum {
  35.           class_ID = 'LPRF'
  36.       } ;
  37.  
  38.     static CPrefListBox*    CreateFromStream(LStream *inStream);
  39.  
  40.                         CPrefListBox ();
  41.                         CPrefListBox(const SPaneInfo &inPaneInfo,
  42.                                     Boolean inHasHorizScroll, Boolean inHasVertScroll,
  43.                                     Boolean inHasGrow, Boolean inHasFocusBox,
  44.                                     MessageT inDoubleClickMessage, Int16 inTextTraitsID,
  45.                                     LCommander *inSuper);
  46.                         CPrefListBox(const CPrefListBox &inOriginal) ;
  47.                         CPrefListBox (LStream *inStream);
  48.                         ~CPrefListBox();
  49.  
  50.     virtual void        *GetSelection (void *outDescriptor, short *outDescLen) const;
  51.     virtual void        SetSelection (const void *inDescriptor, const short inDescLen);
  52.  
  53.     virtual void         *GetCellPtr (const Cell cell, short *dataLen = NULL) ;
  54.  
  55.     virtual void        PrintPanelSelf(const PanelSpec &inPanel);
  56.  
  57.     virtual    void        InsertItemsAt( Uint32 inCount, ArrayIndexT inAtIndex, const void *inItem);
  58.     virtual Boolean        FetchItemAt( ArrayIndexT inAtIndex, void *outItem) const;
  59.  
  60.     virtual LArray&        GetItemList();
  61.  
  62.   protected:
  63.     virtual void        FinishCreateSelf();
  64.     virtual void         DrawElement (const short lMessage, const Boolean lSelect, const Rect *lRect,
  65.                                      const void *lElement, const short lDataLen) ;
  66.  
  67.     virtual    Boolean        HandleKeyPress( const EventRecord &inKeyEvent);
  68.     virtual void        ClickSelf(const SMouseDownEvent &inMouseDown);
  69.  
  70.   private:
  71.               LArray        *mPrefList;
  72.       static    ListDefUPP    callerLDEFUPP;
  73.  
  74.       
  75.       void                InitPrefListBox (void) ;
  76.       friend pascal static void  LDefProc (short lMessage, Boolean lSelect, Rect *lRect,
  77.                                      Cell lCell, unsigned short lDataOffset, unsigned short lDataLen, ListHandle lHandle) ;
  78. };
  79.  
  80. //----------------------------------------------------------------------------
  81.